<script 
	src="http://maps.google.com/jsapi?ie=utf-8&amp;oe=utf-8&amp;key=ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA"
  type="text/javascript">
</script>

<script type="text/javascript">

	google.load("maps", "2.x", {"language" : "en"});
	var map;
	var latlng;

	function initialize()
	{
	  if (GBrowserIsCompatible())
	  {
	    map = new GMap2(document.getElementById("map"));
	    
	    map.addMapType(G_PHYSICAL_MAP);
	    
			var boundaries = new GLatLngBounds(new GLatLng(<?php echo $upLeftLat ?>, <?php $upLeftLng ?>), new GLatLng(<?php echo $lowRightLat ?>, <?php $lowRightLng ?>));
			
			var oldmap = new GGroundOverlay("http://localhost/omwpt/media/data/overlays/testImage.png", boundaries);
			
			map.addOverlay(oldmap);
	    map.addControl(new google.maps.LargeMapControl());
	    map.addControl(new GScaleControl());
	    map.addControl(new google.maps.MapTypeControl());
	    
	    map.enableScrollWheelZoom();
	    
	    map.setCenter(new google.maps.LatLng(35.913679, -79.055927), 13, G_NORMAL_MAP);
	    
	    GEvent.addListener(map, "click", function(overlay, point)
          { setLatLng(point);
          });
	    
	  }
	}
	 
	function setLatLng(point){
		var newLat = new Number(point.lat());
		var newLng = new Number(point.lng());
		document.getElementById('lat').value = newLat.toPrecision(7);
		document.getElementById('lng').value = newLng.toPrecision(7);
	} 
</script>